<?php

/**
 * mesdossiers form base class.
 *
 * @method mesdossiers getObject() Returns the current form's model object
 *
 * @package    e-DSL
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasemesdossiersForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'datedossier'       => new sfWidgetFormDate(),
      'type_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('type'), 'add_empty' => true)),
      'categorie_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'add_empty' => true)),
      'name_client'       => new sfWidgetFormInputText(),
      'name_demandeur'    => new sfWidgetFormInputText(),
      'datereference'     => new sfWidgetFormDate(),
      'dateAction'        => new sfWidgetFormDate(),
      'state'             => new sfWidgetFormInputText(),
      'brouillon'         => new sfWidgetFormInputCheckbox(),
      'urgent'            => new sfWidgetFormInputCheckbox(),
      'ferme'             => new sfWidgetFormInputCheckbox(),
      'fermeTechnique'    => new sfWidgetFormInputCheckbox(),
      'etat_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('etatdossier'), 'add_empty' => true)),
      'client_id'         => new sfWidgetFormInputText(),
      'demandeur_id'      => new sfWidgetFormInputText(),
      'acteur_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('acteur'), 'add_empty' => true)),
      'enAttente'         => new sfWidgetFormInputCheckbox(),
      'raisonAttente'     => new sfWidgetFormTextarea(),
      'persacteur_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('persacteur'), 'add_empty' => true)),
      'acteurpersonne_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('lienacteurpersonne'), 'add_empty' => true)),
      'lienetat_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('lienetat'), 'add_empty' => true)),
      'readOnly'          => new sfWidgetFormInputCheckbox(),
      'departement_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('departement'), 'add_empty' => true)),
      'region_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('region'), 'add_empty' => true)),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'datedossier'       => new sfValidatorDate(array('required' => false)),
      'type_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('type'), 'required' => false)),
      'categorie_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'required' => false)),
      'name_client'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'name_demandeur'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'datereference'     => new sfValidatorDate(array('required' => false)),
      'dateAction'        => new sfValidatorDate(array('required' => false)),
      'state'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'brouillon'         => new sfValidatorBoolean(array('required' => false)),
      'urgent'            => new sfValidatorBoolean(array('required' => false)),
      'ferme'             => new sfValidatorBoolean(array('required' => false)),
      'fermeTechnique'    => new sfValidatorBoolean(array('required' => false)),
      'etat_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('etatdossier'), 'required' => false)),
      'client_id'         => new sfValidatorInteger(array('required' => false)),
      'demandeur_id'      => new sfValidatorInteger(array('required' => false)),
      'acteur_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('acteur'), 'required' => false)),
      'enAttente'         => new sfValidatorBoolean(array('required' => false)),
      'raisonAttente'     => new sfValidatorString(array('required' => false)),
      'persacteur_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('persacteur'), 'required' => false)),
      'acteurpersonne_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('lienacteurpersonne'), 'required' => false)),
      'lienetat_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('lienetat'), 'required' => false)),
      'readOnly'          => new sfValidatorBoolean(array('required' => false)),
      'departement_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('departement'), 'required' => false)),
      'region_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('region'), 'required' => false)),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('mesdossiers[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'mesdossiers';
  }

}
